﻿using System;

namespace Validate.Net
{
    /// <summary>
    /// 中文校验（必须包含中文）
    /// </summary>
    public class ValidateChineseAttribute : ValidateRegularAttribute
    {
        private static string regularStr = @"[\u4e00-\u9fa5]";

        public ValidateChineseAttribute() : base(regularStr)
        {
        }


        public override bool Validate(object value, out string msg)
        {
            if (base.Validate(value, out msg))
                return true;
            else
            {
                msg = "中文校验失败（必须包含中文）";
                return false;
            }
        }
    }
}
